﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace PersistentObject.Common.Criteria
{
    /// <summary>
    /// Represent an IN clause
    /// </summary>
    public class InCriteria : BaseCriteria
    {
        /// <summary>
        /// Indicate the FIELD in the clause FIELD IN (VALUES)
        /// </summary>
        public OperandProperty Field { get; private set; }
        /// <summary>
        /// Indicate the VALUES in the clause FIELD IN (VALUES)
        /// </summary>
        public IList<Operand> Values { get; private set; }

        /// <summary>
        /// The constructor of IN criteria
        /// </summary>
        /// <param name="propertyName">Indicate the property of the mapping type</param>
        /// <param name="values">Indicate the VALUES</param>
        public InCriteria(string propertyName, IEnumerable values)
        {
            Field = new OperandProperty(propertyName);
            Values = new List<Operand>();
            foreach (var item in values)
            {
                Values.Add(new OperandValue(item));
            }
        }


    }
}
